package com.xdemo.manager;

import java.io.Serializable;
import java.util.List;

import com.xdemo.model.BaseEntity;

public class BaseDao<T extends BaseEntity>  {
	
	private DBManager dbManager;
	
	public BaseDao(DBManager dbManager) {
		this.dbManager = dbManager;
	}
	
	public void save(T entity) {
		dbManager.save(entity);
	}
	
	public void update(T entity) {
		dbManager.update(entity);
	}
	
	public void delete(T entity) {
		dbManager.delete(entity);
	}
	
	public  T get(Class<T> entityType,Serializable key) {
		return dbManager.get(entityType, key);
	}
	
	public List<?> findByNameQuery(String queryName,String[] keys,Object[] values) {
		return dbManager.findByNameQuery(queryName, keys, values);
	}
	
	public List<?> findByNameQuery(String queryName) {
		return dbManager.findByNameQuery(queryName, null,null);
	}
	
}
